/*
 * @Author: 陈心怡
 * @Date: 2024-09-18 18:08:17
 * @LastEditors: 陈心怡
 * @LastEditTime: 2024-09-18 19:51:02
 * @FilePath: \vue3-web-study\vite.config.js
 * @Description:
 */
import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'

import eslintPlugin from 'vite-plugin-eslint'

//安装了unplugin-vue-components unplugin-auto-import，components里面的组件自动为全局组件，不用注册
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    eslintPlugin({
      include: ['src/**/*.vue', 'src/**/*.js', 'src/*.js', 'src/*.vue']
    }),
    AutoImport({
      resolvers: [ElementPlusResolver()]
    }),
    Components({
      resolvers: [ElementPlusResolver()]
    })
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
    open: true,
    hmr: true,
    port: 8848
  }
})
